Skip to content

Add support for the publish_generated_columns option to publications. #9049 - #10841

Merged
dpage merged 1 commit into
pgadmin-org:masterfrom
dpage:fix-issue-9049
Nov 27, 2026
Merged

dpage merged 1 commit into
pgadmin-org:masterfrom
dpage:fix-issue-9049

Conversation

@dpage

@dpage dpage commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • PostgreSQL 18 added the publish_generated_columns publication option (enum: none, the default, or stored; it does not exist before 18). The publication dialog now shows a Publish generated columns select in Options > With for PostgreSQL 18 and later.
  • New 18_plus template bucket (pg and ppas) for create.sql, update.sql and properties.sql: properties maps pg_publication.pubgencols to none/stored, create adds the option to the WITH clause when set to stored, and alter emits ALTER PUBLICATION ... SET (publish_generated_columns = ...), rendering only the two accepted values.
  • Reverse-engineered SQL only includes the option when it is stored, so the existing expected output for publications on PostgreSQL 18 is unchanged.
  • Documented the option in publication_dialog.rst.

Test plan

  • runtests.py --pkg resql --modules publications on PostgreSQL 18, with a new tests/18_plus/test.json (the 15_plus scenarios plus create with stored, alter to none, alter back to stored)
  • Publication API tests (--pkg browser.server_groups.servers.databases.publications.tests): 53 passed
  • Jest publication.ui.spec.js and eslint on publication.ui.js

Closes #9049

Summary by CodeRabbit

  • New Features
    • PostgreSQL 18 and later now support choosing whether publications include generated columns. Choose None (the default) or Stored when creating or editing a publication.
    • Publication properties display the generated-column setting, and changes are applied when publications are updated.

…gadmin-org#9049

PostgreSQL 18 adds the publish_generated_columns publication option, which
takes 'none' (the default) or 'stored'. Add it to the publication dialog for
PostgreSQL 18 and later, with new 18_plus SQL templates for create, alter and
properties, and emit it in the reverse-engineered SQL when set to 'stored'.

Closes pgadmin-org#9049
@dpage dpage self-assigned this Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The publication dialog adds a PostgreSQL 18 option for publishing generated columns. PostgreSQL and PPAS templates generate creation and update SQL and return the setting in publication properties. Tests cover publication scenarios, including changes between none and stored.

Changes

Publication generated-column setting

Layer / File(s) Summary
Expose generated-column option
docs/en_US/publication_dialog.rst, web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.ui.js
The dialog adds the PostgreSQL 18 publish_generated_columns field with none as its default and stored as the other option. The documentation describes both values.
Create publications and read settings
web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/{pg,ppas}/18_plus/sql/create.sql, web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/{pg,ppas}/18_plus/sql/properties.sql
The create templates include the stored generated-column option when selected. The properties queries return the setting as stored or none.
Update publication settings and membership
web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/{pg,ppas}/18_plus/sql/update.sql
The update templates generate conditional SQL for changed publication settings, membership, ownership, and name. They update generated-column publishing when the requested value is none or stored and differs from the existing value.
Validate publication SQL scenarios
web/pgadmin/browser/server_groups/servers/databases/publications/tests/18_plus/*
The scenarios and SQL fixtures cover publication creation and alteration, including generated-column settings changing between stored and none.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant PublicationDialog
  participant CreateTemplate
  participant PostgreSQL
  participant PropertiesQuery
  PublicationDialog->>CreateTemplate: selected generated-column setting
  CreateTemplate->>PostgreSQL: CREATE PUBLICATION with stored option when selected
  PublicationDialog->>PropertiesQuery: request publication properties
  PropertiesQuery->>PostgreSQL: select publication catalog values
  PostgreSQL-->>PropertiesQuery: generated-column mode
  PropertiesQuery-->>PublicationDialog: stored or none
  PublicationDialog->>UpdateTemplate: changed generated-column setting
  UpdateTemplate->>PostgreSQL: ALTER PUBLICATION for changed setting
Loading

Suggested reviewers: asheshv

Merge Risk: Minimal · up to e7001

This adds an optional PostgreSQL 18+ setting for publishing generated columns, shown only on supported servers and defaulting to none. Existing output for other cases is preserved, and the new scenarios cover creating the setting and switching it between none and stored. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: adding support for the publish_generated_columns publication option, which the PR implements across the UI, SQL templates, docs, and tests. It also references issue #9…
Linked Issues check Passed Issue #9049 is the only active directly linked issue. Its supplied text gives only the title, "Add support for option publish_generated_columns in Publication". The requirement is therefore support fo…
Out of Scope Changes check Passed All changed areas connect to the publication_generated_columns objective. They are: the UI select and default in publication.ui.js; the 18_plus create, update, properties, and PPAS templates; the …
Full details: Title check

Explanation

The title names the main change: adding support for the publish_generated_columns publication option, which the PR implements across the UI, SQL templates, docs, and tests. It also references issue #9049. The title is specific and matches the changeset, so it passes.

Full details: Linked Issues check

Explanation

Issue #9049 is the only active directly linked issue. Its supplied text gives only the title, "Add support for option publish_generated_columns in Publication". The requirement is therefore support for that publication option. The reviewed head implements it across the stack:

  • UI: publication.ui.js adds the publish_generated_columns select (options none and stored, min_version: 180000, allowClear: false) under the With group. It defaults to none in PublicationSchema.
  • Create SQL: pg/18_plus/sql/create.sql maps publish_generated_columns = stored into the WITH clause. It emits this only when the value is stored, including when no events are selected.
  • Alter SQL: pg/18_plus/sql/update.sql emits ALTER PUBLICATION ... SET (publish_generated_columns = ...) only when the value is none or stored and differs from the existing value.
  • Properties: properties.sql maps pubgencols to stored or none.
  • PPAS templates mirror the PG templates.
    The PR also adds 18_plus SQL test scenarios (create with stored, alter to none, alter to stored). I did not run them. The PR description reports the test results, and I did not verify them independently.
    Uncertainty: the full issue body was not supplied. Any requirement beyond the title is unknown to this assessment.
Full details: Out of Scope Changes check

Explanation

All changed areas connect to the publication_generated_columns objective. They are: the UI select and default in publication.ui.js; the 18_plus create, update, properties, and PPAS templates; the 18_plus test scenarios and SQL fixtures; and the publication_dialog.rst documentation entry. The inspected code changes contain no unrelated behavior. The diff of publication.ui.js contains only the new field and default. The inspected template changes contain only the publication generated-column logic.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3b6b9b2 and e7001fa.

Files selected for processing: 15

  • docs/en_US/publication_dialog.rst
  • web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.ui.js
  • web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/18_plus/sql/create.sql
  • web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/18_plus/sql/properties.sql
  • web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/18_plus/sql/update.sql
  • web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/18_plus/sql/create.sql
  • web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/18_plus/sql/properties.sql
  • web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/18_plus/sql/update.sql
  • web/pgadmin/browser/server_groups/servers/databases/publications/tests/18_plus/alter_publication_gencols_none.sql
  • web/pgadmin/browser/server_groups/servers/databases/publications/tests/18_plus/alter_publication_gencols_none_msql.sql
  • web/pgadmin/browser/server_groups/servers/databases/publications/tests/18_plus/alter_publication_gencols_stored.sql
  • web/pgadmin/browser/server_groups/servers/databases/publications/tests/18_plus/alter_publication_gencols_stored_msql.sql
  • web/pgadmin/browser/server_groups/servers/databases/publications/tests/18_plus/create_publication_gencols_stored.sql
  • web/pgadmin/browser/server_groups/servers/databases/publications/tests/18_plus/create_publication_gencols_stored_msql.sql
  • web/pgadmin/browser/server_groups/servers/databases/publications/tests/18_plus/test.json

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.

@dpage
dpage merged commit d24511f into pgadmin-org:master Nov 27, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for option publish_generated_columns in Publication

1 participant